<template>
	<view class="activity_item">
		<view class="mediaCon">
			<u-image :src="info.pageImg" border-radius="8" height="100%" @click="toActiveDetail"></u-image>
			<view class="c-tag">
				<image src="../static/not_start.png" v-if="info.activeState === 0"></image>
				<image src="../static/underway.png" v-else-if="info.activeState === 1"></image>
			</view>
			<view class="titleCon">
				<view class="title_wrapper">
					<text class="name">{{ info.activeName || '' }}</text>
					<view class="seeCon">
			<!-- 			<text class="iconfont iconchakanliang icon"></text> -->
					<u-icon class="icon" name="eye" size="34"></u-icon>
					<text>{{ info.lookNum || 0 }}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="textCon">
			<view class="place item">
				<text class="iconfont icondingwei icon"></text>
				<text>{{ info.address || '' }}</text>
			</view>
			<view class="organize item">
				<text class="iconfont iconzuzhi icon"></text>
				<text class="lable">发起组织:</text>
				<text class="name">{{ info.createName || '' }}</text>
			</view>
			<view class="recruit item">
				<text class="left">
					<text class="iconfont iconrenshu icon"></text>
					<text class="lable">计划招募:</text>
					<text class="name count">{{ info.person || 0 }}人</text>
				</text>
				<text class="left">
					<text class="iconfont iconrenshu icon"></text>
					<text class="lable">已招募:</text>
					<text class="name count">{{ info.personD || 0 }}人</text>
				</text>
			</view>
			<view class="time item">
				<text class="iconfont iconriqi icon"></text>
				<text class="lable">招募日期:</text>
				<text class="name">{{ handleDate(info.joinStartDate) }} 至 {{ handleDate(info.joinEndDate) }}</text>
			</view>
			<view class="time item">
				<text class="iconfont iconriqi icon"></text>
				<text class="lable">活动日期:</text>
				<text class="name">{{ handleDate(info.activeStartDate) }} 至 {{ handleDate(info.activeEndDate) }}</text>
			</view>
		</view>
		<view class="already" v-if="!showDistance">已有{{ info.personD || 0 }}人报名</view>
	</view>
</template>

<script>
import { handleDate } from '@/utils/util.js';
export default {
	props: {
		info: {
			type: Object,
			default: () => ({})
		},
		showDistance: {
			type: Boolean,
			default: false,
		}
	},
	components: {},
	data() {
		return {};
	},
	methods: {
		handleDate,
		toActiveDetail(){
			this.navigateTo({
				url: `/pages/main/active/detail`
			})
		}
	}
};
</script>

<style lang="scss" scoped>
@import '@/commom/styles/icons.css';
.activity_item {
	position: relative;
	padding-top: 16rpx;

	.mediaCon {
		width: 100%;
		position: relative;
		height: 340rpx;
		border-radius: 8rpx;

		.titleCon {
			width: 100%;
			height: 51rpx;
			position: absolute;
			bottom: 0;
			background: rgba(0, 0, 0, 0.3);
			/* r:red g:green b:blue a:alpha(半透明):0-1,1是不透明，0是全透明 */
			border-radius: 0px 0px 8rpx 8rpx;
			// opacity: 0.4;
			z-index: 2;

			.title_wrapper {
				width: 100%;
				height: 100%;
				padding-left: 16rpx;
				padding-right: 16rpx;
				// padding-bottom: 16rpx;
				// padding-top: 8rpx;
				position: relative;
				display: flex;
				align-items: center;
				opacity: 1 !important;

				.name {
					font-size: 26rpx;
					font-weight: 400;
					color: #ffffff;
					flex: 1;
					margin-right: 50rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}

				.seeCon {
					display: flex;
					height: 43rpx;
					font-size: 24rpx;
					font-weight: 400;
					color: #ffffff;
					align-items: center;

					.icon {
						font-size: 23rpx;
						// margin-top: 8rpx;
						margin-right: 13rpx;
					}
				}
			}
		}
	}

	.textCon {
		width: 100%;
		padding: 16rpx;
		padding-left: 5rpx;
		padding-right: 5rpx;
		display: flex;
		flex-direction: column;

		.item {
			width: 100%;
			// line-height: 33px;
			// display: flex;
			align-items: center;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			margin-bottom: 14rpx;

			&:nth-last-child(1) {
				margin-bottom: 0;
			}

			&.place {
				font-weight: 400;
				color: #333333;
				font-size: 24rpx;
			}

			&.recruit {
				display: flex;

				.left {
					margin-right: 164rpx;
				}

				.count {
					margin-left: 8rpx;
				}
			}

			.icon {
				color: #666666;
				font-size: 25rpx;
				margin-right: 10rpx;
			}

			.lable {
				font-size: 24rpx;
				font-weight: 400;
				color: #666666;
				margin-right: 8rpx;
			}

			.name {
				font-size: 24rpx;
				font-weight: 400;
				color: #333333;
			}
		}
	}

	.already {
		position: absolute;
		width: 166rpx;
		height: 44rpx;
		padding-left: 11rpx;
		line-height: 44rpx;
		background: #eb4d3c;
		border-radius: 8rpx;
		right: 14rpx;
		bottom: 16rpx;
		font-weight: 400;
		color: #ffffff;
		font-size: 24rpx;
	}
}

.c-tag{
	position: absolute;
	right: -6rpx;
	top: -6rpx;
	width: 104rpx;
	height: 104rpx;
}
</style>
